//
//  AppDelegate.m
//  YouthHostel
//
//  Created by Lorain mac pro on 2016/9/29.
//  Copyright © 2016年 Lorain mac pro. All rights reserved.
//

#import "AppDelegate.h"
#import "MyInfoViewController.h"
#import "MyOrder.h"
#import "NewFound.h"
#import "SearchViewController.h"
#import <SMS_SDK/SMSSDK.h>
#define appkey @"176b99cb69a48"
#define app_secrect @"d5e35600eb20cdc167e3028e0eab8d4f"
#import "WSMovieController.h"


@interface AppDelegate ()

@end

@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [NSThread sleepForTimeInterval:0.1];//设置启动页面时间
    
    
    self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    
        NSArray *arr = @[@"搜索",@"发现",@"订单2",@"我的"];
    
        NSArray *arr1 = @[@"搜索01",@"发现01",@"订单02",@"我的01"];
    
        NSArray *brr = @[@"搜索",@"发现",@"订单",@"我的"];
    
        MyOrder *order = [[MyOrder alloc]init];
    
        MyInfoViewController *mine = [[MyInfoViewController alloc]init];
    
        SearchViewController *search = [[SearchViewController alloc]init];
    
        NewFound *newFond = [[NewFound alloc]init];


//        FoundViewController *found = [[FoundViewController alloc]init];
    
    
        UINavigationController *Searchnav = [[UINavigationController alloc]initWithRootViewController:search];
        Searchnav.navigationBar.barTintColor = [UIColor whiteColor];
        Searchnav.navigationBar.tintColor = [UIColor whiteColor];
        [Searchnav.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    
        Searchnav.navigationBarHidden = YES;
    
    
        UINavigationController *foundNav = [[UINavigationController alloc]initWithRootViewController:newFond];
        foundNav.navigationBar.hidden = YES;

    
        UINavigationController *Myinfonav = [[UINavigationController alloc]initWithRootViewController:mine];
        Myinfonav.navigationBar.hidden = YES;
    
    
        UINavigationController *orderNav = [[UINavigationController alloc]initWithRootViewController:order];
    
        orderNav.navigationBar.hidden = YES;
    
//        UINavigationController *Newnav = [[UINavigationController alloc]initWithRootViewController:found];
//        Newnav.navigationBar.barTintColor = [UIColor redColor];
//        Newnav.navigationBar.tintColor = [UIColor blackColor];
//        [Newnav.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
    
//        Newnav.navigationBarHidden  = YES;
    
    
    
       [SMSSDK registerApp:appkey withSecret:app_secrect];

        self.selfTAB = [[SelfTabbar alloc]initWithImage:nil initWithBackImage:arr andSelectImg:arr1 andCount:4 andTitle:brr];
    
        self.selfTAB.viewControllers = @[Searchnav,foundNav,orderNav,Myinfonav];
    

    
//    BOOL isFirstLogin = [[[NSUserDefaults standardUserDefaults] objectForKey:@"isFirstLogin"] boolValue];
//    
//    if (!isFirstLogin) {
        //是第一次

//        wsCtrl.movieURL = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"new"ofType:@"mp4"]];
    
        self.window.rootViewController = _selfTAB;
    
//    WSMovieController *wsVc = [[WSMovieController alloc]init];
//
//    self.window.rootViewController = wsVc;
    
    
//        [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"isFirstLogin"];
//    }else{
//        //不是首次启动
//        self.window.rootViewController = self.selfTAB;
//
//        }

    
    
    
    
//    [self.selfTAB presentModalViewController:wsCtrl animated:YES];
    
    
    
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
